package com.cskaoyan.javase.homework.primary._5oop3.lamba;

/**
 * Lambda表达式表示的子类对象，本质就是一个方法实现，作用是通过方法提供一种规则
 *
 * @since 09:24
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class LambdaRulerDemo {
    public static void main(String[] args) {
        System.out.println(calc((num1, num2) -> num1 + num2, 10, 10));
        System.out.println(calc((num1, num2) -> num1 * num2, 10, 10));
        System.out.println(calc((num1, num2) -> num1 / num2, 10, 10));
        System.out.println(calc((num1, num2) -> num1 - num2, 10, 10));
    }

    public static double calc(Compute com, double num1, double num2) {
        return com.compute(num1, num2);
    }

}

@FunctionalInterface
interface Compute {
    double compute(double a, double b);
}